﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Interview_Prov.Private.Admin
{
    public partial class DeleteInterview : System.Web.UI.Page
    {
        Business.BusinessLogic bll = new Business.BusinessLogic();
        protected void Page_Load(object sender, EventArgs e)
        {
            var interv = bll.LoadInterview(GetInterviewID());
            if (interv.ID==-1)
            {
                Response.Redirect("~\\Errors\\InterviewLoadError.aspx", true);
                return;
            }
            if (interv.State == Entities.Enums.InterviewState.Actual)
            {
                Label2.Visible = true;
                Button1.Visible = false;
                Button2.Visible = false;
                Label1.Visible = false;
                return;
            }

            
        }

        protected int GetInterviewID()
        {
            int iid = -1;
            if (Request.Params["InterviewID"] != null)
            {
                int.TryParse(Request.Params["InterviewID"], out iid);
            }
            return iid;
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("~\\Private\\Admin\\AdminActions.aspx", true);
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            bll.DeleteInterview(GetInterviewID());
            Response.Redirect("~\\Private\\Admin\\AdminActions.aspx", true);
        }
    }
}